#coding=utf-8
import wx
from mainlistbook import MainListBook
from maintoolbar import MainToolBar


class MainFrame(wx.Frame):
    def __init__(self, parent, title='',size=(480,480)):
        wx.Frame.__init__(self, parent, -1, title,(100,100),size)
        self.Maximize()
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) #绑定窗口关闭事件
        self.SetIcon(wx.Icon('./icon/maildisk.ico',wx.BITMAP_TYPE_ICO)) #设置窗口图标

        self.toolbar=MainToolBar(self) #定义工具栏
        self.SetToolBar(self.toolbar)  

        self.listbook=MainListBook(self,-1) #定义listbook

        self.statusbar=self.CreateStatusBar(8,-1,-2) #定义状态栏


    def OnCloseWindow(self, event): #关闭窗口事件处理
        try:
            self.listbook.m.logout()
        except:
            print 'imap not init'
        self.Destroy()
    
app=wx.PySimpleApp()
frame=MainFrame(None,title=u'邮盘 1.0',size=(480,400))
frame.Show()
app.MainLoop()
